package com.sc.test.windowSoftInputMode;

import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ListView;

import com.sc.test.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Shen Chao.
 * Created on 2018-10-25.
 */
public class WindowInputResultActivity extends AppCompatActivity {
    @BindView(R.id.lv_content)
    ListView lvContent;
    private List<EditText> list = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        int inputMode = getIntent().getIntExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
        getWindow().setSoftInputMode(inputMode);
        setContentView(R.layout.activity_windowinputresult);
        ButterKnife.bind(this);
        for (int i = 0; i < 15; i++) {
            EditText editText = new EditText(this);
            editText.setHint("第" + i + "条");
            list.add(editText);
        }
        lvContent.setAdapter(new BaseAdapter() {
            @Override
            public int getCount() {
                return list.size();
            }

            @Override
            public Object getItem(int position) {
                return null;
            }

            @Override
            public long getItemId(int position) {
                return 0;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
                return list.get(position);
            }
        });
    }
}
